/**
 *
 */
import OpenApi;
import OpenApi.OpenApiUtil;

extends OpenApi;


init(config: OpenApiUtil.Config){
  super(config);
  @endpointRule = 'regional';
  
  checkConfig(config);
  @endpoint = getEndpoint('voicenavigator', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!$isNull(endpoint)) {
    return endpoint;
  }
  
  if (!$isNull(endpointMap) && !$isNull(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return OpenApiUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model AssociateChatbotInstanceRequest {
  chatbotInstanceId?: string(name='ChatbotInstanceId', example='chatbot-720edd02b66a'),
  chatbotName?: string(name='ChatbotName'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='af81a389-91f0-4157-8d82-720edd02b66a'),
  nluServiceParamsJson?: string(name='NluServiceParamsJson'),
  nluServiceType?: string(name='NluServiceType'),
  unionSource?: string(name='UnionSource'),
}

model AssociateChatbotInstanceResponseBody = {
  requestId?: string(name='RequestId', example='254EB995-DEDF-48A4-9101-9CA5B72FFBCC'),
}

model AssociateChatbotInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: AssociateChatbotInstanceResponseBody(name='body'),
}

/**
 * @param request AssociateChatbotInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return AssociateChatbotInstanceResponse
 */
async function associateChatbotInstanceWithOptions(request: AssociateChatbotInstanceRequest, runtime: $RuntimeOptions): AssociateChatbotInstanceResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.chatbotInstanceId)) {
    query['ChatbotInstanceId'] = request.chatbotInstanceId;
  }
  if (!$isNull(request.chatbotName)) {
    query['ChatbotName'] = request.chatbotName;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.nluServiceParamsJson)) {
    query['NluServiceParamsJson'] = request.nluServiceParamsJson;
  }
  if (!$isNull(request.nluServiceType)) {
    query['NluServiceType'] = request.nluServiceType;
  }
  if (!$isNull(request.unionSource)) {
    query['UnionSource'] = request.unionSource;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'AssociateChatbotInstance',
    version = '2018-06-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request AssociateChatbotInstanceRequest
 * @return AssociateChatbotInstanceResponse
 */
async function associateChatbotInstance(request: AssociateChatbotInstanceRequest): AssociateChatbotInstanceResponse {
  var runtime = new $RuntimeOptions{};
  return associateChatbotInstanceWithOptions(request, runtime);
}

model AuditTTSVoiceRequest {
  accessKey?: string(name='AccessKey'),
  appKey?: string(name='AppKey'),
  engine?: string(name='Engine'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='af81a389-91f0-4157-8d82-720edd02b66a'),
  pitchRate?: string(name='PitchRate'),
  secretKey?: string(name='SecretKey'),
  speechRate?: string(name='SpeechRate', description='This parameter is required.', example='100'),
  text?: string(name='Text', description='This parameter is required.'),
  voice?: string(name='Voice', description='This parameter is required.', example='aixia'),
  volume?: string(name='Volume', description='This parameter is required.', example='10'),
}

model AuditTTSVoiceResponseBody = {
  auditionUrl?: string(name='AuditionUrl', example='http://voicenavigator-cn-shanghai.oss-cn-shanghai.aliyuncs.com/exported_files/2020-02-20/ttsConfig-1582188148528-abd8e407de0a49b381bb591bd91fc073.wav?Expires=1582188208&OSSAccessKeyId=LTAIppQY5rofntVJ&Signature=FaBassElzqGEB0H2TvTKPJsOJHs%3D'),
  requestId?: string(name='RequestId', example='254EB995-DEDF-48A4-9101-9CA5B72FFBCC'),
}

model AuditTTSVoiceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: AuditTTSVoiceResponseBody(name='body'),
}

/**
 * @summary AuditTTSVoice
 *
 * @param request AuditTTSVoiceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return AuditTTSVoiceResponse
 */
async function auditTTSVoiceWithOptions(request: AuditTTSVoiceRequest, runtime: $RuntimeOptions): AuditTTSVoiceResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.accessKey)) {
    query['AccessKey'] = request.accessKey;
  }
  if (!$isNull(request.appKey)) {
    query['AppKey'] = request.appKey;
  }
  if (!$isNull(request.engine)) {
    query['Engine'] = request.engine;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.pitchRate)) {
    query['PitchRate'] = request.pitchRate;
  }
  if (!$isNull(request.secretKey)) {
    query['SecretKey'] = request.secretKey;
  }
  if (!$isNull(request.speechRate)) {
    query['SpeechRate'] = request.speechRate;
  }
  if (!$isNull(request.text)) {
    query['Text'] = request.text;
  }
  if (!$isNull(request.voice)) {
    query['Voice'] = request.voice;
  }
  if (!$isNull(request.volume)) {
    query['Volume'] = request.volume;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'AuditTTSVoice',
    version = '2018-06-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary AuditTTSVoice
 *
 * @param request AuditTTSVoiceRequest
 * @return AuditTTSVoiceResponse
 */
async function auditTTSVoice(request: AuditTTSVoiceRequest): AuditTTSVoiceResponse {
  var runtime = new $RuntimeOptions{};
  return auditTTSVoiceWithOptions(request, runtime);
}

model BeginDialogueRequest {
  calledNumber?: string(name='CalledNumber', example='10086'),
  callingNumber?: string(name='CallingNumber', description='This parameter is required.', example='1358158****'),
  conversationId?: string(name='ConversationId', description='This parameter is required.', example='c28fc549-d88f-4f6e-85ad-a0806e5e39c0'),
  initialContext?: string(name='InitialContext', example='{\\\\"channelId\\\\":\\\\"fe2559d3-5fc9-4fa5-8314-32b9f762791d\\\\"}'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='4d7db6670b8e41b5adb1f21560ea9272'),
  instanceOwnerId?: long(name='InstanceOwnerId', example='1231639035307976'),
}

model BeginDialogueResponseBody = {
  action?: string(name='Action', example='Broadcast'),
  actionParams?: string(name='ActionParams', example='{\\\\"duration\\\\":31340,\\\\"endTime\\\\":1638243934786,\\\\"hangUpDirection\\\\":\\\\"ivr\\\\",\\\\"startTime\\\\":1638243903446}'),
  interruptible?: boolean(name='Interruptible', example='true'),
  requestId?: string(name='RequestId', example='14C39896-AE6D-4643-9C9A-E0566B2C2DDD'),
  textResponse?: string(name='TextResponse'),
}

model BeginDialogueResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: BeginDialogueResponseBody(name='body'),
}

/**
 * @param request BeginDialogueRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return BeginDialogueResponse
 */
async function beginDialogueWithOptions(request: BeginDialogueRequest, runtime: $RuntimeOptions): BeginDialogueResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.calledNumber)) {
    query['CalledNumber'] = request.calledNumber;
  }
  if (!$isNull(request.callingNumber)) {
    query['CallingNumber'] = request.callingNumber;
  }
  if (!$isNull(request.conversationId)) {
    query['ConversationId'] = request.conversationId;
  }
  if (!$isNull(request.initialContext)) {
    query['InitialContext'] = request.initialContext;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.instanceOwnerId)) {
    query['InstanceOwnerId'] = request.instanceOwnerId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'BeginDialogue',
    version = '2018-06-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request BeginDialogueRequest
 * @return BeginDialogueResponse
 */
async function beginDialogue(request: BeginDialogueRequest): BeginDialogueResponse {
  var runtime = new $RuntimeOptions{};
  return beginDialogueWithOptions(request, runtime);
}

model CollectedNumberRequest {
  additionalContext?: string(name='AdditionalContext'),
  conversationId?: string(name='ConversationId', description='This parameter is required.', example='0099b75d-60fd-4c63-8541-7fbba0ae6bb0'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='0099b75d-60fd-4c63-8541-7fbba0ae6bb0'),
  instanceOwnerId?: long(name='InstanceOwnerId', example='1426738157626835'),
  number?: string(name='Number', example='1500060224'),
}

model CollectedNumberResponseBody = {
  action?: string(name='Action', example='Broadcast'),
  actionParams?: string(name='ActionParams', example='{\\\\"duration\\\\":31340,\\\\"endTime\\\\":1638243934786,\\\\"hangUpDirection\\\\":\\\\"ivr\\\\",\\\\"startTime\\\\":1638243903446}'),
  interruptible?: boolean(name='Interruptible', example='false'),
  requestId?: string(name='RequestId', example='da37319b-6c83-4268-9f19-814aed62e401'),
  textResponse?: string(name='TextResponse'),
}

model CollectedNumberResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CollectedNumberResponseBody(name='body'),
}

/**
 * @param request CollectedNumberRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CollectedNumberResponse
 */
async function collectedNumberWithOptions(request: CollectedNumberRequest, runtime: $RuntimeOptions): CollectedNumberResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.additionalContext)) {
    query['AdditionalContext'] = request.additionalContext;
  }
  if (!$isNull(request.conversationId)) {
    query['ConversationId'] = request.conversationId;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.instanceOwnerId)) {
    query['InstanceOwnerId'] = request.instanceOwnerId;
  }
  if (!$isNull(request.number)) {
    query['Number'] = request.number;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'CollectedNumber',
    version = '2018-06-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request CollectedNumberRequest
 * @return CollectedNumberResponse
 */
async function collectedNumber(request: CollectedNumberRequest): CollectedNumberResponse {
  var runtime = new $RuntimeOptions{};
  return collectedNumberWithOptions(request, runtime);
}

model CreateDownloadUrlRequest {
  downloadTaskId?: string(name='DownloadTaskId', description='This parameter is required.', example='073f092da0a847b9bf76eb88b5931c7a'),
  fileId?: string(name='FileId', description='This parameter is required.', example='22626c39603744f5a08d4d715315561a'),
}

model CreateDownloadUrlResponseBody = {
  code?: string(name='Code', example='OK'),
  fileHttpUrl?: string(name='FileHttpUrl', example='http://ssml-test.oss-cn-shanghai.aliyuncs.com/key'),
  httpStatusCode?: int32(name='HttpStatusCode', example='200'),
  message?: string(name='Message', example='get upload tool url success'),
  requestId?: string(name='RequestId', example='7401D698-0AAC-5909-B68E-88C68805FFB8'),
  success?: boolean(name='Success', example='True'),
}

model CreateDownloadUrlResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateDownloadUrlResponseBody(name='body'),
}

/**
 * @param request CreateDownloadUrlRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateDownloadUrlResponse
 */
async function createDownloadUrlWithOptions(request: CreateDownloadUrlRequest, runtime: $RuntimeOptions): CreateDownloadUrlResponse {
  request.validate();
  var query = OpenApiUtil.query(request.toMap());
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'CreateDownloadUrl',
    version = '2018-06-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request CreateDownloadUrlRequest
 * @return CreateDownloadUrlResponse
 */
async function createDownloadUrl(request: CreateDownloadUrlRequest): CreateDownloadUrlResponse {
  var runtime = new $RuntimeOptions{};
  return createDownloadUrlWithOptions(request, runtime);
}

model CreateInstanceRequest {
  concurrency?: long(name='Concurrency', description='This parameter is required.', example='10'),
  description?: string(name='Description'),
  name?: string(name='Name', description='This parameter is required.'),
  nluServiceParamsJson?: string(name='NluServiceParamsJson'),
  unionInstanceId?: string(name='UnionInstanceId'),
  unionSource?: string(name='UnionSource'),
}

model CreateInstanceResponseBody = {
  instanceId?: string(name='InstanceId', example='c28fc549-d88f-4f6e-85ad-a0806e5e39c0'),
  requestId?: string(name='RequestId', example='9ab43460-c0b9-40e2-8447-48d82c97fc67'),
}

model CreateInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateInstanceResponseBody(name='body'),
}

/**
 * @param request CreateInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateInstanceResponse
 */
async function createInstanceWithOptions(request: CreateInstanceRequest, runtime: $RuntimeOptions): CreateInstanceResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.concurrency)) {
    query['Concurrency'] = request.concurrency;
  }
  if (!$isNull(request.description)) {
    query['Description'] = request.description;
  }
  if (!$isNull(request.name)) {
    query['Name'] = request.name;
  }
  if (!$isNull(request.nluServiceParamsJson)) {
    query['NluServiceParamsJson'] = request.nluServiceParamsJson;
  }
  if (!$isNull(request.unionInstanceId)) {
    query['UnionInstanceId'] = request.unionInstanceId;
  }
  if (!$isNull(request.unionSource)) {
    query['UnionSource'] = request.unionSource;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'CreateInstance',
    version = '2018-06-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request CreateInstanceRequest
 * @return CreateInstanceResponse
 */
async function createInstance(request: CreateInstanceRequest): CreateInstanceResponse {
  var runtime = new $RuntimeOptions{};
  return createInstanceWithOptions(request, runtime);
}

model DebugBeginDialogueRequest {
  calledNumber?: string(name='CalledNumber', example='10086'),
  callingNumber?: string(name='CallingNumber', description='This parameter is required.', example='135815*****'),
  conversationId?: string(name='ConversationId', description='This parameter is required.', example='8a503680-815d-473e-a9b0-e010f47a64d2'),
  initialContext?: string(name='InitialContext', example='{}'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='8a503680-815d-473e-a9b0-e010f47a64d2'),
}

model DebugBeginDialogueResponseBody = {
  action?: string(name='Action', example='Broadcast'),
  actionParams?: string(name='ActionParams', example='{}'),
  interruptible?: boolean(name='Interruptible', example='true'),
  requestId?: string(name='RequestId', example='14C39896-AE6D-4643-9C9A-E0566B2C2DDD'),
  textResponse?: string(name='TextResponse'),
}

model DebugBeginDialogueResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DebugBeginDialogueResponseBody(name='body'),
}

/**
 * @param request DebugBeginDialogueRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DebugBeginDialogueResponse
 */
async function debugBeginDialogueWithOptions(request: DebugBeginDialogueRequest, runtime: $RuntimeOptions): DebugBeginDialogueResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.calledNumber)) {
    query['CalledNumber'] = request.calledNumber;
  }
  if (!$isNull(request.callingNumber)) {
    query['CallingNumber'] = request.callingNumber;
  }
  if (!$isNull(request.conversationId)) {
    query['ConversationId'] = request.conversationId;
  }
  if (!$isNull(request.initialContext)) {
    query['InitialContext'] = request.initialContext;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DebugBeginDialogue',
    version = '2018-06-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request DebugBeginDialogueRequest
 * @return DebugBeginDialogueResponse
 */
async function debugBeginDialogue(request: DebugBeginDialogueRequest): DebugBeginDialogueResponse {
  var runtime = new $RuntimeOptions{};
  return debugBeginDialogueWithOptions(request, runtime);
}

model DebugCollectedNumberRequest {
  conversationId?: string(name='ConversationId', description='This parameter is required.', example='7cefbff0-8d50-4d6f-b93c-73cee23c1555'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='7cefbff0-8d50-4d6f-b93c-73cee23c1555'),
  number?: string(name='Number', example='123'),
}

model DebugCollectedNumberResponseBody = {
  action?: string(name='Action', example='Broadcast'),
  actionParams?: string(name='ActionParams', example='{}'),
  interruptible?: boolean(name='Interruptible', example='true'),
  requestId?: string(name='RequestId', example='abb4aa26-3a8e-43dd-82f8-0c3898c9c67f'),
  textResponse?: string(name='TextResponse'),
}

model DebugCollectedNumberResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DebugCollectedNumberResponseBody(name='body'),
}

/**
 * @param request DebugCollectedNumberRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DebugCollectedNumberResponse
 */
async function debugCollectedNumberWithOptions(request: DebugCollectedNumberRequest, runtime: $RuntimeOptions): DebugCollectedNumberResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.conversationId)) {
    query['ConversationId'] = request.conversationId;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.number)) {
    query['Number'] = request.number;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DebugCollectedNumber',
    version = '2018-06-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request DebugCollectedNumberRequest
 * @return DebugCollectedNumberResponse
 */
async function debugCollectedNumber(request: DebugCollectedNumberRequest): DebugCollectedNumberResponse {
  var runtime = new $RuntimeOptions{};
  return debugCollectedNumberWithOptions(request, runtime);
}

model DebugDialogueRequest {
  additionalContext?: string(name='AdditionalContext', example='{}'),
  conversationId?: string(name='ConversationId', description='This parameter is required.', example='7cefbff0-8d50-4d6f-b93c-73cee23c1555'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='abb4aa26-3a8e-43dd-82f8-0c3898c9c67f'),
  utterance?: string(name='Utterance', description='This parameter is required.'),
}

model DebugDialogueResponseBody = {
  action?: string(name='Action', example='Broadcast'),
  actionParams?: string(name='ActionParams', example='{}'),
  interruptible?: boolean(name='Interruptible', example='true'),
  requestId?: string(name='RequestId', example='d74d6290-7cbe-4436-b5d7-014ebb0f4060'),
  textResponse?: string(name='TextResponse', example='80d11be3-faad-4101-b4b0-59dbea28aaf0'),
}

model DebugDialogueResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DebugDialogueResponseBody(name='body'),
}

/**
 * @param request DebugDialogueRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DebugDialogueResponse
 */
async function debugDialogueWithOptions(request: DebugDialogueRequest, runtime: $RuntimeOptions): DebugDialogueResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.additionalContext)) {
    query['AdditionalContext'] = request.additionalContext;
  }
  if (!$isNull(request.conversationId)) {
    query['ConversationId'] = request.conversationId;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.utterance)) {
    query['Utterance'] = request.utterance;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DebugDialogue',
    version = '2018-06-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request DebugDialogueRequest
 * @return DebugDialogueResponse
 */
async function debugDialogue(request: DebugDialogueRequest): DebugDialogueResponse {
  var runtime = new $RuntimeOptions{};
  return debugDialogueWithOptions(request, runtime);
}

model DeleteInstanceRequest {
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='d74d6290-7cbe-4436-b5d7-014ebb0f4060'),
}

model DeleteInstanceResponseBody = {
  requestId?: string(name='RequestId', example='d74d6290-7cbe-4436-b5d7-014ebb0f4060'),
}

model DeleteInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteInstanceResponseBody(name='body'),
}

/**
 * @param request DeleteInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteInstanceResponse
 */
async function deleteInstanceWithOptions(request: DeleteInstanceRequest, runtime: $RuntimeOptions): DeleteInstanceResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DeleteInstance',
    version = '2018-06-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request DeleteInstanceRequest
 * @return DeleteInstanceResponse
 */
async function deleteInstance(request: DeleteInstanceRequest): DeleteInstanceResponse {
  var runtime = new $RuntimeOptions{};
  return deleteInstanceWithOptions(request, runtime);
}

model DescribeConversationRequest {
  conversationId?: string(name='ConversationId', description='This parameter is required.', example='15608cce-36be-43d5-9361-178cbe64127b'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='5daac920-d6c1-429f-a95f-2a798f5255b5'),
}

model DescribeConversationResponseBody = {
  beginTime?: long(name='BeginTime', example='1582103260434'),
  callingNumber?: string(name='CallingNumber', example='138106*****'),
  conversationId?: string(name='ConversationId', example='2d5aa451-661f-4f08-b0c4-28eec78decc4'),
  effectiveAnswerCount?: int32(name='EffectiveAnswerCount', example='8'),
  endTime?: long(name='EndTime', example='1582103299434'),
  requestId?: string(name='RequestId', example='14C39896-AE6D-4643-9C9A-E0566B2C2DDD'),
  skillGroupId?: string(name='SkillGroupId', example='ABABCBAC'),
  transferredToAgent?: boolean(name='TransferredToAgent', example='true'),
  userUtteranceCount?: int32(name='UserUtteranceCount', example='10'),
}

model DescribeConversationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeConversationResponseBody(name='body'),
}

/**
 * @param request DescribeConversationRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeConversationResponse
 */
async function describeConversationWithOptions(request: DescribeConversationRequest, runtime: $RuntimeOptions): DescribeConversationResponse {
  request.validate();
  var query = OpenApiUtil.query(request.toMap());
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeConversation',
    version = '2018-06-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request DescribeConversationRequest
 * @return DescribeConversationResponse
 */
async function describeConversation(request: DescribeConversationRequest): DescribeConversationResponse {
  var runtime = new $RuntimeOptions{};
  return describeConversationWithOptions(request, runtime);
}

model DescribeConversationContextRequest {
  conversationId?: string(name='ConversationId', description='This parameter is required.', example='361c8a53-0e29-42f3-8aa7-c7752d010399'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='026ca0f4-483b-4252-ae1d-1f15f056f8b9'),
}

model DescribeConversationContextResponseBody = {
  conversationContext?: string(name='ConversationContext', example='{         "CallingNumber": "135815***",         "AdditionalContext": "",         "ConversationId": "361c8a53-0e29-42f3-8aa7-c7752d010399"     }'),
  requestId?: string(name='RequestId', example='b19af5ce5314ac08108d1b33fe20e15'),
}

model DescribeConversationContextResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeConversationContextResponseBody(name='body'),
}

/**
 * @param request DescribeConversationContextRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeConversationContextResponse
 */
async function describeConversationContextWithOptions(request: DescribeConversationContextRequest, runtime: $RuntimeOptions): DescribeConversationContextResponse {
  request.validate();
  var query = OpenApiUtil.query(request.toMap());
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeConversationContext',
    version = '2018-06-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request DescribeConversationContextRequest
 * @return DescribeConversationContextResponse
 */
async function describeConversationContext(request: DescribeConversationContextRequest): DescribeConversationContextResponse {
  var runtime = new $RuntimeOptions{};
  return describeConversationContextWithOptions(request, runtime);
}

model DescribeExportProgressRequest {
  exportTaskId?: string(name='ExportTaskId', description='This parameter is required.', example='0de8e5ccc2b645039ae6fbda443da73f'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='868eef14-7515-4856-8a50-5c9a22abdbcc'),
}

model DescribeExportProgressResponseBody = {
  fileHttpUrl?: string(name='FileHttpUrl', example='http://ssml-test.oss-cn-shanghai.aliyuncs.com/key'),
  requestId?: string(name='RequestId', example='b19af5ce5314ac08108d1b33fe20e15'),
  status?: string(name='Status', example='FINISHED'),
}

model DescribeExportProgressResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeExportProgressResponseBody(name='body'),
}

/**
 * @param request DescribeExportProgressRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeExportProgressResponse
 */
async function describeExportProgressWithOptions(request: DescribeExportProgressRequest, runtime: $RuntimeOptions): DescribeExportProgressResponse {
  request.validate();
  var query = OpenApiUtil.query(request.toMap());
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeExportProgress',
    version = '2018-06-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request DescribeExportProgressRequest
 * @return DescribeExportProgressResponse
 */
async function describeExportProgress(request: DescribeExportProgressRequest): DescribeExportProgressResponse {
  var runtime = new $RuntimeOptions{};
  return describeExportProgressWithOptions(request, runtime);
}

model DescribeInstanceRequest {
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='ecbfa5e3-1838-4e8a-aa08-fa8b713b82df'),
}

model DescribeInstanceResponseBody = {
  abilityType?: string(name='AbilityType'),
  applicableOperations?: [ string ](name='ApplicableOperations'),
  concurrency?: long(name='Concurrency', example='10'),
  description?: string(name='Description'),
  instanceId?: string(name='InstanceId', example='test1_instanceId'),
  modifyTime?: long(name='ModifyTime', example='1532436395329'),
  modifyUserName?: string(name='ModifyUserName'),
  name?: string(name='Name'),
  nluServiceParamsJson?: string(name='NluServiceParamsJson'),
  requestId?: string(name='RequestId', example='14C39896-AE6D-4643-9C9A-E0566B2C2DDD'),
  status?: string(name='Status', example='Drafted'),
  unionInstanceId?: string(name='UnionInstanceId'),
  unionSource?: string(name='UnionSource'),
}

model DescribeInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeInstanceResponseBody(name='body'),
}

/**
 * @param request DescribeInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeInstanceResponse
 */
async function describeInstanceWithOptions(request: DescribeInstanceRequest, runtime: $RuntimeOptions): DescribeInstanceResponse {
  request.validate();
  var query = OpenApiUtil.query(request.toMap());
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeInstance',
    version = '2018-06-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request DescribeInstanceRequest
 * @return DescribeInstanceResponse
 */
async function describeInstance(request: DescribeInstanceRequest): DescribeInstanceResponse {
  var runtime = new $RuntimeOptions{};
  return describeInstanceWithOptions(request, runtime);
}

model DescribeNavigationConfigRequest {
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='287289b6-1510-4e64-9224-39b53ad89dd2'),
}

model DescribeNavigationConfigResponseBody = {
  greetingConfig?: {
    greetingWords?: string(name='GreetingWords'),
    intentTrigger?: string(name='IntentTrigger'),
    sourceType?: string(name='SourceType', example='chatbotIntent'),
  }(name='GreetingConfig'),
  requestId?: string(name='RequestId', example='14C39896-AE6D-4643-9C9A-E0566B2C2DDD'),
  silenceTimeoutConfig?: {
    finalAction?: string(name='FinalAction', example='HangUp'),
    finalActionParams?: string(name='FinalActionParams', example='{}'),
    finalPrompt?: string(name='FinalPrompt'),
    intentTrigger?: string(name='IntentTrigger', description='""', example='""'),
    prompt?: string(name='Prompt'),
    sourceType?: string(name='SourceType', example='chatbotIntent'),
    threshold?: int32(name='Threshold', example='3'),
    timeout?: long(name='Timeout', example='10'),
  }(name='SilenceTimeoutConfig'),
  unrecognizingConfig?: {
    finalAction?: string(name='FinalAction', example='TransferToAgent'),
    finalActionParams?: string(name='FinalActionParams', example='{ \\\\"skillGroupId\\\\": \\\\"fallbackSkillGroup\\\\" }'),
    finalPrompt?: string(name='FinalPrompt'),
    prompt?: string(name='Prompt'),
    threshold?: int32(name='Threshold', example='3'),
  }(name='UnrecognizingConfig'),
}

model DescribeNavigationConfigResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeNavigationConfigResponseBody(name='body'),
}

/**
 * @param request DescribeNavigationConfigRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeNavigationConfigResponse
 */
async function describeNavigationConfigWithOptions(request: DescribeNavigationConfigRequest, runtime: $RuntimeOptions): DescribeNavigationConfigResponse {
  request.validate();
  var query = OpenApiUtil.query(request.toMap());
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeNavigationConfig',
    version = '2018-06-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request DescribeNavigationConfigRequest
 * @return DescribeNavigationConfigResponse
 */
async function describeNavigationConfig(request: DescribeNavigationConfigRequest): DescribeNavigationConfigResponse {
  var runtime = new $RuntimeOptions{};
  return describeNavigationConfigWithOptions(request, runtime);
}

model DescribeRecordingRequest {
  conversationId?: string(name='ConversationId', description='This parameter is required.', example='abb4aa26-3a8e-43dd-82f8-0c3898c9c67f'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='7cefbff0-8d50-4d6f-b93c-73cee23c1555'),
  needVoiceSliceRecording?: boolean(name='NeedVoiceSliceRecording'),
}

model DescribeRecordingResponseBody = {
  fileName?: string(name='FileName', example='2019080913202222.wav'),
  filePath?: string(name='FilePath', example='url'),
  requestId?: string(name='RequestId', example='14C39896-AE6D-4643-9C9A-E0566B2C2DDD'),
  voiceSliceRecordingListJson?: string(name='VoiceSliceRecordingListJson'),
}

model DescribeRecordingResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeRecordingResponseBody(name='body'),
}

/**
 * @param request DescribeRecordingRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeRecordingResponse
 */
async function describeRecordingWithOptions(request: DescribeRecordingRequest, runtime: $RuntimeOptions): DescribeRecordingResponse {
  request.validate();
  var query = OpenApiUtil.query(request.toMap());
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeRecording',
    version = '2018-06-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request DescribeRecordingRequest
 * @return DescribeRecordingResponse
 */
async function describeRecording(request: DescribeRecordingRequest): DescribeRecordingResponse {
  var runtime = new $RuntimeOptions{};
  return describeRecordingWithOptions(request, runtime);
}

model DescribeStatisticalDataRequest {
  beginTimeLeftRange?: long(name='BeginTimeLeftRange', example='1582283640000'),
  beginTimeRightRange?: long(name='BeginTimeRightRange', example='1582298040000'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='c28fc549-d88f-4f6e-85ad-a0806e5e39c0'),
  timeUnit?: string(name='TimeUnit', description='This parameter is required.', example='Day/Hour'),
}

model DescribeStatisticalDataResponseBody = {
  conversationTotalNum?: long(name='ConversationTotalNum', example='100'),
  requestId?: string(name='RequestId', example='14C39896-AE6D-4643-9C9A-E0566B2C2DDD'),
  resolvedQuestionTotalNum?: long(name='ResolvedQuestionTotalNum', example='80'),
  statisticalDataReports?: [ 
    {
      dialoguePassRate?: string(name='DialoguePassRate', example='80.00%'),
      knowledgeHitRate?: string(name='KnowledgeHitRate', example='80.00%'),
      resolutionRate?: string(name='ResolutionRate', example='80.00%'),
      resolvedQuestionNum?: int32(name='ResolvedQuestionNum', example='80'),
      statisticalDate?: string(name='StatisticalDate', example='19:00:00'),
      totalConversationNum?: int32(name='TotalConversationNum', example='100'),
      validAnswerRate?: string(name='ValidAnswerRate', example='80.0'),
    }
  ](name='StatisticalDataReports'),
  totalDialoguePassRate?: string(name='TotalDialoguePassRate', example='80.00%'),
  totalKnowledgeHitRate?: string(name='TotalKnowledgeHitRate', example='80.00%'),
  totalResolutionRate?: string(name='TotalResolutionRate', example='80.00%'),
  totalValidAnswerRate?: string(name='TotalValidAnswerRate', example='80.00%'),
}

model DescribeStatisticalDataResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeStatisticalDataResponseBody(name='body'),
}

/**
 * @param request DescribeStatisticalDataRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeStatisticalDataResponse
 */
async function describeStatisticalDataWithOptions(request: DescribeStatisticalDataRequest, runtime: $RuntimeOptions): DescribeStatisticalDataResponse {
  request.validate();
  var query = OpenApiUtil.query(request.toMap());
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeStatisticalData',
    version = '2018-06-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request DescribeStatisticalDataRequest
 * @return DescribeStatisticalDataResponse
 */
async function describeStatisticalData(request: DescribeStatisticalDataRequest): DescribeStatisticalDataResponse {
  var runtime = new $RuntimeOptions{};
  return describeStatisticalDataWithOptions(request, runtime);
}

model DescribeTTSConfigRequest {
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='dc437bba-5a25-4bbc-b4c2-f268864bebb5'),
  instanceOwnerId?: long(name='InstanceOwnerId', example='1971226538081821'),
}

model DescribeTTSConfigResponseBody = {
  aliCustomizedVoice?: string(name='AliCustomizedVoice'),
  appKey?: string(name='AppKey'),
  engine?: string(name='Engine'),
  engineXunfei?: string(name='EngineXunfei'),
  nlsServiceType?: string(name='NlsServiceType'),
  pitchRate?: int32(name='PitchRate'),
  requestId?: string(name='RequestId', example='F132DDBA-66C4-5BD3-BF7E-9642FE877158'),
  speechRate?: int32(name='SpeechRate', example='-150'),
  voice?: string(name='Voice', example='aixia'),
  volume?: int32(name='Volume', example='50'),
}

model DescribeTTSConfigResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeTTSConfigResponseBody(name='body'),
}

/**
 * @summary 获取TTS配置
 *
 * @param request DescribeTTSConfigRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeTTSConfigResponse
 */
async function describeTTSConfigWithOptions(request: DescribeTTSConfigRequest, runtime: $RuntimeOptions): DescribeTTSConfigResponse {
  request.validate();
  var query = OpenApiUtil.query(request.toMap());
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeTTSConfig',
    version = '2018-06-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取TTS配置
 *
 * @param request DescribeTTSConfigRequest
 * @return DescribeTTSConfigResponse
 */
async function describeTTSConfig(request: DescribeTTSConfigRequest): DescribeTTSConfigResponse {
  var runtime = new $RuntimeOptions{};
  return describeTTSConfigWithOptions(request, runtime);
}

model DialogueRequest {
  additionalContext?: string(name='AdditionalContext', example='{}'),
  calledNumber?: string(name='CalledNumber', example='10086'),
  callingNumber?: string(name='CallingNumber', example='18851708605'),
  conversationId?: string(name='ConversationId', description='This parameter is required.', example='da37319b-6c83-4268-9f19-814aed62e401'),
  emotion?: string(name='Emotion'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='21e0b2a3-168d-4ba7-9009-afc42666eb54'),
  instanceOwnerId?: long(name='InstanceOwnerId', example='1426738157626835'),
  utterance?: string(name='Utterance', description='This parameter is required.'),
}

model DialogueResponseBody = {
  action?: string(name='Action', example='Broadcast'),
  actionParams?: string(name='ActionParams', example='{\\\\"duration\\\\":2420,\\\\"endTime\\\\":1651717326805,\\\\"hangUpDirection\\\\":\\\\"client\\\\",\\\\"hasLastPlaybackCompleted\\\\":true,\\\\"startTime\\\\":1651717324385}'),
  interruptible?: boolean(name='Interruptible', example='true'),
  requestId?: string(name='RequestId', example='9DB8BA95-4513-54B9-9C67-A28909CFB4AD'),
  textResponse?: string(name='TextResponse'),
}

model DialogueResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DialogueResponseBody(name='body'),
}

/**
 * @param request DialogueRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DialogueResponse
 */
async function dialogueWithOptions(request: DialogueRequest, runtime: $RuntimeOptions): DialogueResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.additionalContext)) {
    query['AdditionalContext'] = request.additionalContext;
  }
  if (!$isNull(request.calledNumber)) {
    query['CalledNumber'] = request.calledNumber;
  }
  if (!$isNull(request.callingNumber)) {
    query['CallingNumber'] = request.callingNumber;
  }
  if (!$isNull(request.conversationId)) {
    query['ConversationId'] = request.conversationId;
  }
  if (!$isNull(request.emotion)) {
    query['Emotion'] = request.emotion;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.instanceOwnerId)) {
    query['InstanceOwnerId'] = request.instanceOwnerId;
  }
  if (!$isNull(request.utterance)) {
    query['Utterance'] = request.utterance;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'Dialogue',
    version = '2018-06-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request DialogueRequest
 * @return DialogueResponse
 */
async function dialogue(request: DialogueRequest): DialogueResponse {
  var runtime = new $RuntimeOptions{};
  return dialogueWithOptions(request, runtime);
}

model DisableInstanceRequest {
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='da37319b-6c83-4268-9f19-814aed62e401'),
}

model DisableInstanceResponseBody = {
  requestId?: string(name='RequestId', example='14C39896-AE6D-4643-9C9A-E0566B2C2DDD'),
  status?: string(name='Status', example='true'),
}

model DisableInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DisableInstanceResponseBody(name='body'),
}

/**
 * @param request DisableInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DisableInstanceResponse
 */
async function disableInstanceWithOptions(request: DisableInstanceRequest, runtime: $RuntimeOptions): DisableInstanceResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DisableInstance',
    version = '2018-06-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request DisableInstanceRequest
 * @return DisableInstanceResponse
 */
async function disableInstance(request: DisableInstanceRequest): DisableInstanceResponse {
  var runtime = new $RuntimeOptions{};
  return disableInstanceWithOptions(request, runtime);
}

model EnableInstanceRequest {
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='da37319b-6c83-4268-9f19-814aed62e401'),
}

model EnableInstanceResponseBody = {
  requestId?: string(name='RequestId', example='3a530dc0-7cfa-48f6-9539-bf9001e77b16'),
  status?: string(name='Status', example='true'),
}

model EnableInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: EnableInstanceResponseBody(name='body'),
}

/**
 * @param request EnableInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return EnableInstanceResponse
 */
async function enableInstanceWithOptions(request: EnableInstanceRequest, runtime: $RuntimeOptions): EnableInstanceResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'EnableInstance',
    version = '2018-06-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request EnableInstanceRequest
 * @return EnableInstanceResponse
 */
async function enableInstance(request: EnableInstanceRequest): EnableInstanceResponse {
  var runtime = new $RuntimeOptions{};
  return enableInstanceWithOptions(request, runtime);
}

model EndDialogueRequest {
  conversationId?: string(name='ConversationId', description='This parameter is required.', example='8fb819b5-d032-48a9-ae5e-cff041b83596'),
  hangUpParams?: string(name='HangUpParams', example='{\\\\"duration\\\\":40,\\\\"endTime\\\\":1645082505345,\\\\"hangUpDirection\\\\":\\\\"ivr\\\\",\\\\"hasLastPlaybackCompleted\\\\":true,\\\\"startTime\\\\":1645082505305}'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='e48e45dd-e47a-4744-a063-f08cbebb1c5a'),
  instanceOwnerId?: long(name='InstanceOwnerId', example='1399572315967217'),
}

model EndDialogueResponseBody = {
  requestId?: string(name='RequestId', example='e48e45dd-e47a-4744-a063-f08cbebb1c5a'),
}

model EndDialogueResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: EndDialogueResponseBody(name='body'),
}

/**
 * @param request EndDialogueRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return EndDialogueResponse
 */
async function endDialogueWithOptions(request: EndDialogueRequest, runtime: $RuntimeOptions): EndDialogueResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.conversationId)) {
    query['ConversationId'] = request.conversationId;
  }
  if (!$isNull(request.hangUpParams)) {
    query['HangUpParams'] = request.hangUpParams;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.instanceOwnerId)) {
    query['InstanceOwnerId'] = request.instanceOwnerId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'EndDialogue',
    version = '2018-06-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request EndDialogueRequest
 * @return EndDialogueResponse
 */
async function endDialogue(request: EndDialogueRequest): EndDialogueResponse {
  var runtime = new $RuntimeOptions{};
  return endDialogueWithOptions(request, runtime);
}

model ExportConversationDetailsRequest {
  beginTimeLeftRange?: long(name='BeginTimeLeftRange', example='1582266750353'),
  beginTimeRightRange?: long(name='BeginTimeRightRange', example='1640793599000'),
  callingNumber?: string(name='CallingNumber', example='13581588**'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='6c01a99f-1b72-4f75-a8bd-3875766bd19d'),
  options?: [ string ](name='Options'),
  result?: int32(name='Result'),
  roundsLeftRange?: int32(name='RoundsLeftRange'),
  roundsRightRange?: int32(name='RoundsRightRange'),
}

model ExportConversationDetailsResponseBody = {
  exportTaskId?: string(name='ExportTaskId', example='6203fc87271a420c98eab6c2bbc2d856'),
  requestId?: string(name='RequestId', example='75BAAB9B-40B2-5FF5-A59A-7BCF8154C6EE'),
}

model ExportConversationDetailsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ExportConversationDetailsResponseBody(name='body'),
}

/**
 * @param request ExportConversationDetailsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ExportConversationDetailsResponse
 */
async function exportConversationDetailsWithOptions(request: ExportConversationDetailsRequest, runtime: $RuntimeOptions): ExportConversationDetailsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.beginTimeLeftRange)) {
    query['BeginTimeLeftRange'] = request.beginTimeLeftRange;
  }
  if (!$isNull(request.beginTimeRightRange)) {
    query['BeginTimeRightRange'] = request.beginTimeRightRange;
  }
  if (!$isNull(request.callingNumber)) {
    query['CallingNumber'] = request.callingNumber;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.options)) {
    query['Options'] = request.options;
  }
  if (!$isNull(request.result)) {
    query['Result'] = request.result;
  }
  if (!$isNull(request.roundsLeftRange)) {
    query['RoundsLeftRange'] = request.roundsLeftRange;
  }
  if (!$isNull(request.roundsRightRange)) {
    query['RoundsRightRange'] = request.roundsRightRange;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ExportConversationDetails',
    version = '2018-06-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request ExportConversationDetailsRequest
 * @return ExportConversationDetailsResponse
 */
async function exportConversationDetails(request: ExportConversationDetailsRequest): ExportConversationDetailsResponse {
  var runtime = new $RuntimeOptions{};
  return exportConversationDetailsWithOptions(request, runtime);
}

model ExportStatisticalDataRequest {
  beginTimeLeftRange?: long(name='BeginTimeLeftRange', example='1582266750353'),
  beginTimeRightRange?: long(name='BeginTimeRightRange', example='1582266750353'),
  exportType?: string(name='ExportType', description='This parameter is required.', example='statistical'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='29b52d70-d9fe-4fe0-8476-8aaacbcfdc84'),
  timeUnit?: string(name='TimeUnit', description='This parameter is required.', example='Hour'),
}

model ExportStatisticalDataResponseBody = {
  exportTaskId?: string(name='ExportTaskId', example='6be5a9f1-406e-424e-a17b-b6fb86ee3cc9'),
  requestId?: string(name='RequestId', example='c62e6789-28a8-41db-941e-171a01d3b3b9'),
}

model ExportStatisticalDataResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ExportStatisticalDataResponseBody(name='body'),
}

/**
 * @param request ExportStatisticalDataRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ExportStatisticalDataResponse
 */
async function exportStatisticalDataWithOptions(request: ExportStatisticalDataRequest, runtime: $RuntimeOptions): ExportStatisticalDataResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.beginTimeLeftRange)) {
    query['BeginTimeLeftRange'] = request.beginTimeLeftRange;
  }
  if (!$isNull(request.beginTimeRightRange)) {
    query['BeginTimeRightRange'] = request.beginTimeRightRange;
  }
  if (!$isNull(request.exportType)) {
    query['ExportType'] = request.exportType;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.timeUnit)) {
    query['TimeUnit'] = request.timeUnit;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ExportStatisticalData',
    version = '2018-06-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request ExportStatisticalDataRequest
 * @return ExportStatisticalDataResponse
 */
async function exportStatisticalData(request: ExportStatisticalDataRequest): ExportStatisticalDataResponse {
  var runtime = new $RuntimeOptions{};
  return exportStatisticalDataWithOptions(request, runtime);
}

model GenerateUploadUrlRequest {
  callerBid?: string(name='CallerBid'),
  callerIp?: string(name='CallerIp'),
  callerParentId?: long(name='CallerParentId'),
  callerType?: string(name='CallerType'),
  callerUid?: long(name='CallerUid'),
  clientIp?: string(name='ClientIp'),
  environment?: int32(name='Environment'),
  fileName?: string(name='FileName'),
  instanceId?: string(name='InstanceId'),
  instanceOwnerId?: long(name='InstanceOwnerId'),
  key?: string(name='Key'),
  mfaPresent?: boolean(name='MfaPresent'),
  proxyOriginalSecurityTransport?: boolean(name='ProxyOriginalSecurityTransport'),
  proxyOriginalSourceIp?: string(name='ProxyOriginalSourceIp'),
  proxyTrustTransportInfo?: boolean(name='ProxyTrustTransportInfo'),
  requestId?: string(name='RequestId'),
  securityToken?: string(name='SecurityToken'),
  securityTransport?: boolean(name='SecurityTransport'),
  tenantId?: long(name='TenantId'),
  tenantName?: string(name='TenantName'),
  userId?: long(name='UserId'),
  userName?: string(name='UserName'),
  xspaceServicerId?: long(name='XspaceServicerId'),
  xspaceTenantBuId?: long(name='XspaceTenantBuId'),
}

model GenerateUploadUrlResponseBody = {
  code?: string(name='Code'),
  data?: {
    accessId?: string(name='AccessId'),
    expire?: int32(name='Expire'),
    folder?: string(name='Folder'),
    host?: string(name='Host'),
    message?: string(name='Message'),
    policy?: string(name='Policy'),
    signature?: string(name='Signature'),
    success?: boolean(name='Success'),
  }(name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GenerateUploadUrlResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GenerateUploadUrlResponseBody(name='body'),
}

/**
 * @param request GenerateUploadUrlRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GenerateUploadUrlResponse
 */
async function generateUploadUrlWithOptions(request: GenerateUploadUrlRequest, runtime: $RuntimeOptions): GenerateUploadUrlResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.callerBid)) {
    body['CallerBid'] = request.callerBid;
  }
  if (!$isNull(request.callerIp)) {
    body['CallerIp'] = request.callerIp;
  }
  if (!$isNull(request.callerParentId)) {
    body['CallerParentId'] = request.callerParentId;
  }
  if (!$isNull(request.callerType)) {
    body['CallerType'] = request.callerType;
  }
  if (!$isNull(request.callerUid)) {
    body['CallerUid'] = request.callerUid;
  }
  if (!$isNull(request.clientIp)) {
    body['ClientIp'] = request.clientIp;
  }
  if (!$isNull(request.environment)) {
    body['Environment'] = request.environment;
  }
  if (!$isNull(request.fileName)) {
    body['FileName'] = request.fileName;
  }
  if (!$isNull(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.instanceOwnerId)) {
    body['InstanceOwnerId'] = request.instanceOwnerId;
  }
  if (!$isNull(request.key)) {
    body['Key'] = request.key;
  }
  if (!$isNull(request.mfaPresent)) {
    body['MfaPresent'] = request.mfaPresent;
  }
  if (!$isNull(request.proxyOriginalSecurityTransport)) {
    body['ProxyOriginalSecurityTransport'] = request.proxyOriginalSecurityTransport;
  }
  if (!$isNull(request.proxyOriginalSourceIp)) {
    body['ProxyOriginalSourceIp'] = request.proxyOriginalSourceIp;
  }
  if (!$isNull(request.proxyTrustTransportInfo)) {
    body['ProxyTrustTransportInfo'] = request.proxyTrustTransportInfo;
  }
  if (!$isNull(request.requestId)) {
    body['RequestId'] = request.requestId;
  }
  if (!$isNull(request.securityToken)) {
    body['SecurityToken'] = request.securityToken;
  }
  if (!$isNull(request.securityTransport)) {
    body['SecurityTransport'] = request.securityTransport;
  }
  if (!$isNull(request.tenantId)) {
    body['TenantId'] = request.tenantId;
  }
  if (!$isNull(request.tenantName)) {
    body['TenantName'] = request.tenantName;
  }
  if (!$isNull(request.userId)) {
    body['UserId'] = request.userId;
  }
  if (!$isNull(request.userName)) {
    body['UserName'] = request.userName;
  }
  if (!$isNull(request.xspaceServicerId)) {
    body['XspaceServicerId'] = request.xspaceServicerId;
  }
  if (!$isNull(request.xspaceTenantBuId)) {
    body['XspaceTenantBuId'] = request.xspaceTenantBuId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'GenerateUploadUrl',
    version = '2018-06-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request GenerateUploadUrlRequest
 * @return GenerateUploadUrlResponse
 */
async function generateUploadUrl(request: GenerateUploadUrlRequest): GenerateUploadUrlResponse {
  var runtime = new $RuntimeOptions{};
  return generateUploadUrlWithOptions(request, runtime);
}

model GetAsrConfigRequest {
  configLevel?: int32(name='ConfigLevel', example='1'),
  entryId?: string(name='EntryId', example='3b1d3031-8b6e-460a-8640-d330f2ca50b8'),
}

model GetAsrConfigResponseBody = {
  code?: string(name='Code', example='OK'),
  data?: {
    asrAcousticModelId?: string(name='AsrAcousticModelId', example='3b1d3031-8b6e-460a-8640-d330f2ca50b8'),
    asrClassVocabularyId?: string(name='AsrClassVocabularyId', example='3b1d3031-8b6e-460a-8640-d330f2ca50b8'),
    asrCustomizationId?: string(name='AsrCustomizationId', example='3b1d3031-8b6e-460a-8640-d330f2ca50b8'),
    asrVocabularyId?: string(name='AsrVocabularyId', example='3b1d3031-8b6e-460a-8640-d330f2ca50b8'),
    engine?: string(name='Engine'),
    engineXufei?: string(name='EngineXufei'),
  }(name='Data'),
  errorMsg?: string(name='ErrorMsg', example='Not Found'),
  httpStatusCode?: int32(name='HttpStatusCode', example='200'),
  requestId?: string(name='RequestId', example='14C39896-AE6D-4643-9C9A-E0566B2C2DDD'),
  success?: boolean(name='Success', example='True'),
}

model GetAsrConfigResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetAsrConfigResponseBody(name='body'),
}

/**
 * @param request GetAsrConfigRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetAsrConfigResponse
 */
async function getAsrConfigWithOptions(request: GetAsrConfigRequest, runtime: $RuntimeOptions): GetAsrConfigResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.configLevel)) {
    query['ConfigLevel'] = request.configLevel;
  }
  if (!$isNull(request.entryId)) {
    query['EntryId'] = request.entryId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetAsrConfig',
    version = '2018-06-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request GetAsrConfigRequest
 * @return GetAsrConfigResponse
 */
async function getAsrConfig(request: GetAsrConfigRequest): GetAsrConfigResponse {
  var runtime = new $RuntimeOptions{};
  return getAsrConfigWithOptions(request, runtime);
}

model GetRealTimeConcurrencyRequest {
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='c112c168ed664c0a851f9ca72d2f7999'),
}

model GetRealTimeConcurrencyResponseBody = {
  maxConcurrency?: long(name='MaxConcurrency', example='2'),
  realTimeConcurrency?: long(name='RealTimeConcurrency', example='1'),
  requestId?: string(name='RequestId', example='E6E61E1A-D2DC-5ACF-AED4-A115B6691F98'),
  timestamp?: long(name='Timestamp', example='1661584255029'),
}

model GetRealTimeConcurrencyResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetRealTimeConcurrencyResponseBody(name='body'),
}

/**
 * @summary GetRealTimeConcurrency
 *
 * @param request GetRealTimeConcurrencyRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetRealTimeConcurrencyResponse
 */
async function getRealTimeConcurrencyWithOptions(request: GetRealTimeConcurrencyRequest, runtime: $RuntimeOptions): GetRealTimeConcurrencyResponse {
  request.validate();
  var query = OpenApiUtil.query(request.toMap());
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetRealTimeConcurrency',
    version = '2018-06-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary GetRealTimeConcurrency
 *
 * @param request GetRealTimeConcurrencyRequest
 * @return GetRealTimeConcurrencyResponse
 */
async function getRealTimeConcurrency(request: GetRealTimeConcurrencyRequest): GetRealTimeConcurrencyResponse {
  var runtime = new $RuntimeOptions{};
  return getRealTimeConcurrencyWithOptions(request, runtime);
}

model ListChatbotInstancesRequest {
  instanceId?: string(name='InstanceId', example='af81a389-91f0-4157-8d82-720edd02b66a'),
  nluServiceParamsJson?: string(name='NluServiceParamsJson'),
  nluServiceType?: string(name='NluServiceType'),
  pageNumber?: int32(name='PageNumber', description='This parameter is required.', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
  unionSource?: string(name='UnionSource'),
}

model ListChatbotInstancesResponseBody = {
  bots?: [ 
    {
      avatar?: string(name='Avatar', example='https://dss0.ali.com/70cFuHS.jpg'),
      createTime?: string(name='CreateTime', example='1582266750353'),
      instanceId?: string(name='InstanceId', example='af81a389-91f0-4157-8d82-720edd02b66a'),
      introduction?: string(name='Introduction', example='‘’'),
      languageCode?: string(name='LanguageCode', example='zh-cn'),
      name?: string(name='Name'),
      timeZone?: string(name='TimeZone', example='UTC+8'),
    }
  ](name='Bots'),
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: long(name='PageSize', example='10'),
  requestId?: string(name='RequestId', example='da37319b-6c83-4268-9f19-814aed62e401'),
  totalCount?: long(name='TotalCount', example='10'),
}

model ListChatbotInstancesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListChatbotInstancesResponseBody(name='body'),
}

/**
 * @param request ListChatbotInstancesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListChatbotInstancesResponse
 */
async function listChatbotInstancesWithOptions(request: ListChatbotInstancesRequest, runtime: $RuntimeOptions): ListChatbotInstancesResponse {
  request.validate();
  var query = OpenApiUtil.query(request.toMap());
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListChatbotInstances',
    version = '2018-06-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request ListChatbotInstancesRequest
 * @return ListChatbotInstancesResponse
 */
async function listChatbotInstances(request: ListChatbotInstancesRequest): ListChatbotInstancesResponse {
  var runtime = new $RuntimeOptions{};
  return listChatbotInstancesWithOptions(request, runtime);
}

model ListConversationDetailsRequest {
  conversationId?: string(name='ConversationId', description='This parameter is required.', example='a2c26e67-5984-4935-984e-bcee52971993'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='82b2eaae-ce5c-45f8-8231-f15b6b27e55c'),
}

model ListConversationDetailsResponseBody = {
  conversationDetails?: [ 
    {
      action?: string(name='Action', example='Dialogue'),
      actionParams?: string(name='ActionParams', example='{}'),
      conversationId?: string(name='ConversationId', example='af81a389-91f0-4157-8d82-720edd02b66a'),
      createTime?: long(name='CreateTime', example='1582266750353'),
      sequenceId?: string(name='SequenceId', example='af81a389-91f0-4157-8d82-720edd02b66a'),
      speaker?: string(name='Speaker', example='Chatbot'),
      utterance?: string(name='Utterance'),
    }
  ](name='ConversationDetails'),
  requestId?: string(name='RequestId', example='14C39896-AE6D-4643-9C9A-E0566B2C2DDD'),
}

model ListConversationDetailsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListConversationDetailsResponseBody(name='body'),
}

/**
 * @param request ListConversationDetailsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListConversationDetailsResponse
 */
async function listConversationDetailsWithOptions(request: ListConversationDetailsRequest, runtime: $RuntimeOptions): ListConversationDetailsResponse {
  request.validate();
  var query = OpenApiUtil.query(request.toMap());
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListConversationDetails',
    version = '2018-06-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request ListConversationDetailsRequest
 * @return ListConversationDetailsResponse
 */
async function listConversationDetails(request: ListConversationDetailsRequest): ListConversationDetailsResponse {
  var runtime = new $RuntimeOptions{};
  return listConversationDetailsWithOptions(request, runtime);
}

model ListConversationsRequest {
  beginTimeLeftRange?: long(name='BeginTimeLeftRange', example='1638288000000'),
  beginTimeRightRange?: long(name='BeginTimeRightRange', example='1637547875311'),
  callingNumber?: string(name='CallingNumber', example='138106*****'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='da37319b-6c83-4268-9f19-814aed62e401'),
  isSandBox?: string(name='IsSandBox', example='false'),
  pageNumber?: int32(name='PageNumber', description='This parameter is required.', example='1'),
  pageSize?: int32(name='PageSize', description='This parameter is required.', example='10'),
  query?: string(name='Query', example='13788914724'),
  result?: long(name='Result', example='0'),
  roundsLeftRange?: int32(name='RoundsLeftRange'),
  roundsRightRange?: int32(name='RoundsRightRange'),
}

model ListConversationsResponseBody = {
  conversations?: [ 
    {
      calledNumber?: string(name='CalledNumber'),
      callingNumber?: string(name='CallingNumber', example='135815884***'),
      conversationId?: string(name='ConversationId', example='82b2eaae-ce5c-45f8-8231-f15b6b27e55c'),
      dsReport?: string(name='DsReport'),
      dsReportTitles?: [ string ](name='DsReportTitles'),
      endReason?: int32(name='EndReason', example='1'),
      endTime?: long(name='EndTime', example='1582266750353'),
      hasLastPlaybackCompleted?: boolean(name='HasLastPlaybackCompleted', example='true'),
      hasToAgent?: boolean(name='HasToAgent'),
      rounds?: int32(name='Rounds', example='2'),
      sandBox?: boolean(name='SandBox', example='true'),
      skillGroup?: string(name='SkillGroup'),
      startTime?: long(name='StartTime', example='1641625694286'),
    }
  ](name='Conversations'),
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
  requestId?: string(name='RequestId', example='a2c26e67-5984-4935-984e-bcee52971993'),
  totalCount?: long(name='TotalCount', example='1'),
}

model ListConversationsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListConversationsResponseBody(name='body'),
}

/**
 * @param request ListConversationsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListConversationsResponse
 */
async function listConversationsWithOptions(request: ListConversationsRequest, runtime: $RuntimeOptions): ListConversationsResponse {
  request.validate();
  var query = OpenApiUtil.query(request.toMap());
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListConversations',
    version = '2018-06-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request ListConversationsRequest
 * @return ListConversationsResponse
 */
async function listConversations(request: ListConversationsRequest): ListConversationsResponse {
  var runtime = new $RuntimeOptions{};
  return listConversationsWithOptions(request, runtime);
}

model ListDownloadTasksRequest {
  pageNumber?: int32(name='PageNumber', description='This parameter is required.', example='1'),
  pageSize?: int32(name='PageSize', description='This parameter is required.', example='5'),
}

model ListDownloadTasksResponseBody = {
  code?: string(name='Code', example='OK'),
  downloadTasks?: {
    list?: [ 
      {
        downloadTaskFiles?: [ 
          {
            fileId?: string(name='FileId', example='c32bf5675b704dc5b19200a89d2e85f1'),
            progress?: int32(name='Progress', example='70'),
            status?: string(name='Status', example='Published'),
            title?: string(name='Title'),
          }
        ](name='DownloadTaskFiles'),
        expireTime?: long(name='ExpireTime', example='1637119221702'),
        status?: string(name='Status', example='Expired'),
        taskId?: string(name='TaskId', example='cb9aba69-f578-42b2-aa2f-3e5a41947db8'),
        title?: string(name='Title'),
      }
    ](name='List'),
    pageNumber?: int32(name='PageNumber', example='1'),
    pageSize?: int32(name='PageSize', example='10'),
    totalCount?: int32(name='TotalCount', example='2'),
  }(name='DownloadTasks'),
  httpStatusCode?: int32(name='HttpStatusCode', example='200'),
  message?: string(name='Message', example='successful'),
  requestId?: string(name='RequestId', example='D24E0148-6D40-550E-9471-B2C5A34C3D12'),
  success?: boolean(name='Success', example='True'),
}

model ListDownloadTasksResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListDownloadTasksResponseBody(name='body'),
}

/**
 * @summary 下载列表
 *
 * @param request ListDownloadTasksRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListDownloadTasksResponse
 */
async function listDownloadTasksWithOptions(request: ListDownloadTasksRequest, runtime: $RuntimeOptions): ListDownloadTasksResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListDownloadTasks',
    version = '2018-06-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 下载列表
 *
 * @param request ListDownloadTasksRequest
 * @return ListDownloadTasksResponse
 */
async function listDownloadTasks(request: ListDownloadTasksRequest): ListDownloadTasksResponse {
  var runtime = new $RuntimeOptions{};
  return listDownloadTasksWithOptions(request, runtime);
}

model ListInstancesRequest {
  instanceIdListJsonString?: string(name='InstanceIdListJsonString'),
  name?: string(name='Name'),
  nluServiceTypeListJsonString?: string(name='NluServiceTypeListJsonString', example='[Managed]'),
  number?: string(name='Number'),
  pageNumber?: int32(name='PageNumber', description='This parameter is required.', example='1'),
  pageSize?: int32(name='PageSize', description='This parameter is required.', example='10'),
  status?: string(name='Status'),
  unionInstanceId?: string(name='UnionInstanceId'),
  unionSource?: string(name='UnionSource'),
}

model ListInstancesResponseBody = {
  instances?: [ 
    {
      applicableOperations?: [ string ](name='ApplicableOperations'),
      concurrency?: long(name='Concurrency', example='10'),
      createTime?: long(name='CreateTime'),
      description?: string(name='Description'),
      instanceId?: string(name='InstanceId', example='dc437bba-5a25-4bbc-b4c2-f268864bebb5'),
      modifyTime?: long(name='ModifyTime', example='1582266750353'),
      modifyUserName?: string(name='ModifyUserName', example='xxx'),
      name?: string(name='Name'),
      nluServiceParamsJson?: string(name='NluServiceParamsJson'),
      numbers?: [ string ](name='Numbers'),
      status?: string(name='Status', example='Published'),
      unionInstanceId?: string(name='UnionInstanceId'),
      unionSource?: string(name='UnionSource'),
    }
  ](name='Instances'),
  pageNumber?: int32(name='PageNumber', example='2'),
  pageSize?: int32(name='PageSize', example='10'),
  requestId?: string(name='RequestId', example='A8AED3C8-F57B-5D71-9A34-4A170287533F'),
  totalCount?: int32(name='TotalCount', example='1'),
}

model ListInstancesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListInstancesResponseBody(name='body'),
}

/**
 * @param request ListInstancesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListInstancesResponse
 */
async function listInstancesWithOptions(request: ListInstancesRequest, runtime: $RuntimeOptions): ListInstancesResponse {
  request.validate();
  var query = OpenApiUtil.query(request.toMap());
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListInstances',
    version = '2018-06-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request ListInstancesRequest
 * @return ListInstancesResponse
 */
async function listInstances(request: ListInstancesRequest): ListInstancesResponse {
  var runtime = new $RuntimeOptions{};
  return listInstancesWithOptions(request, runtime);
}

model ModifyAsrConfigRequest {
  asrAcousticModelId?: string(name='AsrAcousticModelId', example='6cc9f5ca-2cb6-4cc7-a46b-2bbfd3e61b22'),
  asrClassVocabularyId?: string(name='AsrClassVocabularyId', example='6cc9f5ca-2cb6-4cc7-a46b-2bbfd3e61b22'),
  asrCustomizationId?: string(name='AsrCustomizationId', example='6cc9f5ca-2cb6-4cc7-a46b-2bbfd3e61b22'),
  asrVocabularyId?: string(name='AsrVocabularyId', example='6cc9f5ca-2cb6-4cc7-a46b-2bbfd3e61b22'),
  configLevel?: int32(name='ConfigLevel', example='0'),
  engine?: string(name='Engine'),
  entryId?: string(name='EntryId', example='6cc9f5ca-2cb6-4cc7-a46b-2bbfd3e61b22'),
}

model ModifyAsrConfigResponseBody = {
  code?: string(name='Code', example='OK'),
  data?: {
    affectedRows?: int32(name='AffectedRows'),
  }(name='Data'),
  errorMsg?: string(name='ErrorMsg', example='Not Found'),
  httpStatusCode?: int32(name='HttpStatusCode', example='200'),
  requestId?: string(name='RequestId', example='da37319b-6c83-4268-9f19-814aed62e401'),
  success?: boolean(name='Success', example='True'),
}

model ModifyAsrConfigResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyAsrConfigResponseBody(name='body'),
}

/**
 * @param request ModifyAsrConfigRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyAsrConfigResponse
 */
async function modifyAsrConfigWithOptions(request: ModifyAsrConfigRequest, runtime: $RuntimeOptions): ModifyAsrConfigResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.asrAcousticModelId)) {
    query['AsrAcousticModelId'] = request.asrAcousticModelId;
  }
  if (!$isNull(request.asrClassVocabularyId)) {
    query['AsrClassVocabularyId'] = request.asrClassVocabularyId;
  }
  if (!$isNull(request.asrCustomizationId)) {
    query['AsrCustomizationId'] = request.asrCustomizationId;
  }
  if (!$isNull(request.asrVocabularyId)) {
    query['AsrVocabularyId'] = request.asrVocabularyId;
  }
  if (!$isNull(request.configLevel)) {
    query['ConfigLevel'] = request.configLevel;
  }
  if (!$isNull(request.engine)) {
    query['Engine'] = request.engine;
  }
  if (!$isNull(request.entryId)) {
    query['EntryId'] = request.entryId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyAsrConfig',
    version = '2018-06-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request ModifyAsrConfigRequest
 * @return ModifyAsrConfigResponse
 */
async function modifyAsrConfig(request: ModifyAsrConfigRequest): ModifyAsrConfigResponse {
  var runtime = new $RuntimeOptions{};
  return modifyAsrConfigWithOptions(request, runtime);
}

model ModifyGreetingConfigRequest {
  greetingWords?: string(name='GreetingWords', description='This parameter is required.'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='12f407b22cbe4890ac595f09985848d5'),
  intentTrigger?: string(name='IntentTrigger'),
  sourceType?: string(name='SourceType', description='This parameter is required.', example='chatbotIntent'),
}

model ModifyGreetingConfigResponseBody = {
  requestId?: string(name='RequestId', example='14C39896-AE6D-4643-9C9A-E0566B2C2DDD'),
}

model ModifyGreetingConfigResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyGreetingConfigResponseBody(name='body'),
}

/**
 * @param request ModifyGreetingConfigRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyGreetingConfigResponse
 */
async function modifyGreetingConfigWithOptions(request: ModifyGreetingConfigRequest, runtime: $RuntimeOptions): ModifyGreetingConfigResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.greetingWords)) {
    query['GreetingWords'] = request.greetingWords;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.intentTrigger)) {
    query['IntentTrigger'] = request.intentTrigger;
  }
  if (!$isNull(request.sourceType)) {
    query['SourceType'] = request.sourceType;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyGreetingConfig',
    version = '2018-06-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request ModifyGreetingConfigRequest
 * @return ModifyGreetingConfigResponse
 */
async function modifyGreetingConfig(request: ModifyGreetingConfigRequest): ModifyGreetingConfigResponse {
  var runtime = new $RuntimeOptions{};
  return modifyGreetingConfigWithOptions(request, runtime);
}

model ModifyInstanceRequest {
  concurrency?: long(name='Concurrency', description='This parameter is required.', example='10'),
  description?: string(name='Description'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='12f407b22cbe4890ac595f09985848d5'),
  name?: string(name='Name'),
}

model ModifyInstanceResponseBody = {
  requestId?: string(name='RequestId', example='14C39896-AE6D-4643-9C9A-E0566B2C2DDD'),
}

model ModifyInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyInstanceResponseBody(name='body'),
}

/**
 * @param request ModifyInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyInstanceResponse
 */
async function modifyInstanceWithOptions(request: ModifyInstanceRequest, runtime: $RuntimeOptions): ModifyInstanceResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.concurrency)) {
    query['Concurrency'] = request.concurrency;
  }
  if (!$isNull(request.description)) {
    query['Description'] = request.description;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.name)) {
    query['Name'] = request.name;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyInstance',
    version = '2018-06-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request ModifyInstanceRequest
 * @return ModifyInstanceResponse
 */
async function modifyInstance(request: ModifyInstanceRequest): ModifyInstanceResponse {
  var runtime = new $RuntimeOptions{};
  return modifyInstanceWithOptions(request, runtime);
}

model ModifySilenceTimeoutConfigRequest {
  finalAction?: string(name='FinalAction', description='This parameter is required.', example='TransferToAgent'),
  finalActionParams?: string(name='FinalActionParams', example='{}'),
  finalPrompt?: string(name='FinalPrompt', description='This parameter is required.'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='12f407b22cbe4890ac595f09985848d5'),
  intentTrigger?: string(name='IntentTrigger', example='Timeout'),
  prompt?: string(name='Prompt', description='This parameter is required.'),
  sourceType?: string(name='SourceType', description='This parameter is required.', example='chatbotIntent'),
  threshold?: int32(name='Threshold', description='This parameter is required.', example='3'),
  timeout?: long(name='Timeout', description='This parameter is required.', example='20'),
}

model ModifySilenceTimeoutConfigResponseBody = {
  requestId?: string(name='RequestId', example='14C39896-AE6D-4643-9C9A-E0566B2C2DDD'),
}

model ModifySilenceTimeoutConfigResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifySilenceTimeoutConfigResponseBody(name='body'),
}

/**
 * @param request ModifySilenceTimeoutConfigRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifySilenceTimeoutConfigResponse
 */
async function modifySilenceTimeoutConfigWithOptions(request: ModifySilenceTimeoutConfigRequest, runtime: $RuntimeOptions): ModifySilenceTimeoutConfigResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.finalAction)) {
    query['FinalAction'] = request.finalAction;
  }
  if (!$isNull(request.finalActionParams)) {
    query['FinalActionParams'] = request.finalActionParams;
  }
  if (!$isNull(request.finalPrompt)) {
    query['FinalPrompt'] = request.finalPrompt;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.intentTrigger)) {
    query['IntentTrigger'] = request.intentTrigger;
  }
  if (!$isNull(request.prompt)) {
    query['Prompt'] = request.prompt;
  }
  if (!$isNull(request.sourceType)) {
    query['SourceType'] = request.sourceType;
  }
  if (!$isNull(request.threshold)) {
    query['Threshold'] = request.threshold;
  }
  if (!$isNull(request.timeout)) {
    query['Timeout'] = request.timeout;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifySilenceTimeoutConfig',
    version = '2018-06-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request ModifySilenceTimeoutConfigRequest
 * @return ModifySilenceTimeoutConfigResponse
 */
async function modifySilenceTimeoutConfig(request: ModifySilenceTimeoutConfigRequest): ModifySilenceTimeoutConfigResponse {
  var runtime = new $RuntimeOptions{};
  return modifySilenceTimeoutConfigWithOptions(request, runtime);
}

model ModifyTTSConfigRequest {
  aliCustomizedVoice?: string(name='AliCustomizedVoice'),
  appKey?: string(name='AppKey'),
  engine?: string(name='Engine'),
  engineXunfei?: string(name='EngineXunfei'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='12f407b22cbe4890ac595f09985848d5'),
  nlsServiceType?: string(name='NlsServiceType'),
  speechRate?: string(name='SpeechRate', example='100'),
  voice?: string(name='Voice', example='aixia'),
  volume?: string(name='Volume', example='10'),
}

model ModifyTTSConfigResponseBody = {
  requestId?: string(name='RequestId', example='14C39896-AE6D-4643-9C9A-E0566B2C2DDD'),
}

model ModifyTTSConfigResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyTTSConfigResponseBody(name='body'),
}

/**
 * @summary 修改TTS配置
 *
 * @param request ModifyTTSConfigRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyTTSConfigResponse
 */
async function modifyTTSConfigWithOptions(request: ModifyTTSConfigRequest, runtime: $RuntimeOptions): ModifyTTSConfigResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.aliCustomizedVoice)) {
    query['AliCustomizedVoice'] = request.aliCustomizedVoice;
  }
  if (!$isNull(request.appKey)) {
    query['AppKey'] = request.appKey;
  }
  if (!$isNull(request.engine)) {
    query['Engine'] = request.engine;
  }
  if (!$isNull(request.engineXunfei)) {
    query['EngineXunfei'] = request.engineXunfei;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.nlsServiceType)) {
    query['NlsServiceType'] = request.nlsServiceType;
  }
  if (!$isNull(request.speechRate)) {
    query['SpeechRate'] = request.speechRate;
  }
  if (!$isNull(request.voice)) {
    query['Voice'] = request.voice;
  }
  if (!$isNull(request.volume)) {
    query['Volume'] = request.volume;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyTTSConfig',
    version = '2018-06-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 修改TTS配置
 *
 * @param request ModifyTTSConfigRequest
 * @return ModifyTTSConfigResponse
 */
async function modifyTTSConfig(request: ModifyTTSConfigRequest): ModifyTTSConfigResponse {
  var runtime = new $RuntimeOptions{};
  return modifyTTSConfigWithOptions(request, runtime);
}

model ModifyUnrecognizingConfigRequest {
  finalAction?: string(name='FinalAction', description='This parameter is required.', example='TransferToAgent'),
  finalActionParams?: string(name='FinalActionParams', example='{}'),
  finalPrompt?: string(name='FinalPrompt', description='This parameter is required.'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='12f407b22cbe4890ac595f09985848d5'),
  prompt?: string(name='Prompt', description='This parameter is required.'),
  threshold?: int32(name='Threshold', description='This parameter is required.', example='3'),
}

model ModifyUnrecognizingConfigResponseBody = {
  requestId?: string(name='RequestId', example='14C39896-AE6D-4643-9C9A-E0566B2C2DDD'),
}

model ModifyUnrecognizingConfigResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyUnrecognizingConfigResponseBody(name='body'),
}

/**
 * @param request ModifyUnrecognizingConfigRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyUnrecognizingConfigResponse
 */
async function modifyUnrecognizingConfigWithOptions(request: ModifyUnrecognizingConfigRequest, runtime: $RuntimeOptions): ModifyUnrecognizingConfigResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.finalAction)) {
    query['FinalAction'] = request.finalAction;
  }
  if (!$isNull(request.finalActionParams)) {
    query['FinalActionParams'] = request.finalActionParams;
  }
  if (!$isNull(request.finalPrompt)) {
    query['FinalPrompt'] = request.finalPrompt;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.prompt)) {
    query['Prompt'] = request.prompt;
  }
  if (!$isNull(request.threshold)) {
    query['Threshold'] = request.threshold;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyUnrecognizingConfig',
    version = '2018-06-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request ModifyUnrecognizingConfigRequest
 * @return ModifyUnrecognizingConfigResponse
 */
async function modifyUnrecognizingConfig(request: ModifyUnrecognizingConfigRequest): ModifyUnrecognizingConfigResponse {
  var runtime = new $RuntimeOptions{};
  return modifyUnrecognizingConfigWithOptions(request, runtime);
}

model QueryConversationsRequest {
  beginTimeLeftRange?: long(name='BeginTimeLeftRange', example='1582183381000'),
  beginTimeRightRange?: long(name='BeginTimeRightRange', example='1582356181000'),
  callingNumber?: string(name='CallingNumber', example='02811111111'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='12f407b22cbe4890ac595f09985848d5'),
  pageNumber?: int32(name='PageNumber', description='This parameter is required.', example='1'),
  pageSize?: int32(name='PageSize', description='This parameter is required.', example='10'),
}

model QueryConversationsResponseBody = {
  conversations?: [ 
    {
      beginTime?: long(name='BeginTime', example='1582183381000'),
      callingNumber?: string(name='CallingNumber', example='02811111111'),
      conversationId?: string(name='ConversationId', example='af81a389-91f0-4157-8d82-720edd02b66a'),
      effectiveAnswerCount?: int32(name='EffectiveAnswerCount', example='8'),
      endTime?: long(name='EndTime', example='1582183481000'),
      skillGroupId?: string(name='SkillGroupId', example='AAA'),
      transferredToAgent?: boolean(name='TransferredToAgent', example='true'),
      userUtteranceCount?: int32(name='UserUtteranceCount', example='10'),
    }
  ](name='Conversations'),
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
  requestId?: string(name='RequestId', example='14C39896-AE6D-4643-9C9A-E0566B2C2DDD'),
  totalCount?: long(name='TotalCount', example='100'),
}

model QueryConversationsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QueryConversationsResponseBody(name='body'),
}

/**
 * @param request QueryConversationsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return QueryConversationsResponse
 */
async function queryConversationsWithOptions(request: QueryConversationsRequest, runtime: $RuntimeOptions): QueryConversationsResponse {
  request.validate();
  var query = OpenApiUtil.query(request.toMap());
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'QueryConversations',
    version = '2018-06-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request QueryConversationsRequest
 * @return QueryConversationsResponse
 */
async function queryConversations(request: QueryConversationsRequest): QueryConversationsResponse {
  var runtime = new $RuntimeOptions{};
  return queryConversationsWithOptions(request, runtime);
}

model SaveRecordingRequest {
  conversationId?: string(name='ConversationId', description='This parameter is required.', example='390515b5-6115-4ccf-83e2-52d5bfaf2ddf'),
  duration?: string(name='Duration', description='This parameter is required.', example='10'),
  fileName?: string(name='FileName', description='This parameter is required.', example='e6bef0db439d4048bfcf45322491becf.wav'),
  filePath?: string(name='FilePath', description='This parameter is required.', example='oss://test/record/'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='af81a389-91f0-4157-8d82-720edd02b66a'),
  instanceOwnerId?: long(name='InstanceOwnerId', example='1971226538081821'),
  startTime?: long(name='StartTime', description='This parameter is required.', example='1582267398628'),
  type?: string(name='Type', description='This parameter is required.', example='Source'),
  voiceSliceRecordingList?: string(name='VoiceSliceRecordingList'),
}

model SaveRecordingResponseBody = {
  requestId?: string(name='RequestId', example='254EB995-DEDF-48A4-9101-9CA5B72FFBCC'),
}

model SaveRecordingResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SaveRecordingResponseBody(name='body'),
}

/**
 * @param request SaveRecordingRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SaveRecordingResponse
 */
async function saveRecordingWithOptions(request: SaveRecordingRequest, runtime: $RuntimeOptions): SaveRecordingResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.conversationId)) {
    query['ConversationId'] = request.conversationId;
  }
  if (!$isNull(request.duration)) {
    query['Duration'] = request.duration;
  }
  if (!$isNull(request.fileName)) {
    query['FileName'] = request.fileName;
  }
  if (!$isNull(request.filePath)) {
    query['FilePath'] = request.filePath;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.instanceOwnerId)) {
    query['InstanceOwnerId'] = request.instanceOwnerId;
  }
  if (!$isNull(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!$isNull(request.type)) {
    query['Type'] = request.type;
  }
  if (!$isNull(request.voiceSliceRecordingList)) {
    query['VoiceSliceRecordingList'] = request.voiceSliceRecordingList;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'SaveRecording',
    version = '2018-06-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request SaveRecordingRequest
 * @return SaveRecordingResponse
 */
async function saveRecording(request: SaveRecordingRequest): SaveRecordingResponse {
  var runtime = new $RuntimeOptions{};
  return saveRecordingWithOptions(request, runtime);
}

model SilenceTimeoutRequest {
  conversationId?: string(name='ConversationId', description='This parameter is required.', example='0099b75d-60fd-4c63-8541-7fbba0ae6bb0'),
  initialContext?: string(name='InitialContext', example='{}'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='0099b75d-60fd-4c63-8541-7fbba0ae6bb0'),
  instanceOwnerId?: long(name='InstanceOwnerId', example='1231639035307976'),
}

model SilenceTimeoutResponseBody = {
  action?: string(name='Action', example='TransferToAgent'),
  actionParams?: string(name='ActionParams', example='{ "skillGroupId": "ABC"}'),
  interruptible?: boolean(name='Interruptible', example='false'),
  requestId?: string(name='RequestId', example='254EB995-DEDF-48A4-9101-9CA5B72FFBCC'),
  textResponse?: string(name='TextResponse'),
}

model SilenceTimeoutResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SilenceTimeoutResponseBody(name='body'),
}

/**
 * @param request SilenceTimeoutRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SilenceTimeoutResponse
 */
async function silenceTimeoutWithOptions(request: SilenceTimeoutRequest, runtime: $RuntimeOptions): SilenceTimeoutResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.conversationId)) {
    query['ConversationId'] = request.conversationId;
  }
  if (!$isNull(request.initialContext)) {
    query['InitialContext'] = request.initialContext;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.instanceOwnerId)) {
    query['InstanceOwnerId'] = request.instanceOwnerId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'SilenceTimeout',
    version = '2018-06-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @param request SilenceTimeoutRequest
 * @return SilenceTimeoutResponse
 */
async function silenceTimeout(request: SilenceTimeoutRequest): SilenceTimeoutResponse {
  var runtime = new $RuntimeOptions{};
  return silenceTimeoutWithOptions(request, runtime);
}

